# Makefile made from Makefile for the ROOT test programs.
# Author: Fons Rademakers, 29/2/2000
# Modified: Max Nolte, 21/10/2013

RC     := root-config
ifeq ($(findstring $(MAKECMDTARGET),clean),)
ifeq ($(shell which $(RC) 2>&1 | sed -ne "s@.*/$(RC)@$(RC)@p"),$(RC))
MKARCH := $(wildcard $(shell $(RC) --etcdir)/Makefile.arch)
RCONFIG := $(wildcard $(shell $(RC) --incdir)/RConfigure.h)
endif
ifneq ($(MKARCH),)
include $(MKARCH)
else
ifeq ($(ROOTSYS),)
ROOTSYS = ..
endif
include $(ROOTSYS)/etc/Makefile.arch
endif
endif

ifeq ($(ROOTSYS),)
ROOTSYS = ..
endif
-include ../MyConfig.mk

#------------------------------------------------------------------------------

#HWORLDO       = hworld.$(ObjSuf)
#HWORLDS       = hworld.$(SrcSuf)
#HWORLD        = hworld$(ExeSuf)

HISTCOMBINED1O       = histogramCreationCombined.$(ObjSuf) treeCreationLHEDict.$(ObjSuf)
HISTCOMBINED1S       = histogramCreationCombined.$(SrcSuf) treeCreationLHEDict.$(SrcSuf)
HISTCOMBINED1        = histogramCreationCombined

HISTCOMBINED2O       = histogramCreationCombined2.$(ObjSuf)
HISTCOMBINED2S       = histogramCreationCombined2.$(SrcSuf)
HISTCOMBINED2        = histogramCreationCombined2

TREELHEO	     = treeCreationLHE.$(ObjSuf) treeCreationLHEDict.$(ObjSuf)
TREELHES	     = treeCreationLHE.$(SrcSuf) treeCreationLHEDict.$(SrcSuf)
TREELHE		     = treeCreationLHE

TREELHCOO             = treeCreationLHCO.$(ObjSuf) treeCreationLHEDict.$(ObjSuf)
TREELHCOS             = treeCreationLHCO.$(SrcSuf) treeCreationLHEDict.$(SrcSuf)
TREELHCO              = treeCreationLHCO

ADDMADWEIGHTO		= addMadWeight.$(ObjSuf) treeCreationLHEDict.$(ObjSuf)
ADDMADWEIGHTS		= addMadWeight.$(SrcSuf) treeCreationLHEDict.$(SrcSuf)
ADDMADWEIGHT		= addMadWeight


OBJS          = $(HISTCOMBINED1O) $(HISTCOMBINED2O) $(TREELHEO) $(TREELHCOO) $(ADDMADWEIGHTO)
PROGRAMS      = $(HISTCOMBINED1) $(HISTCOMBINED2) $(TREELHE) $(TREELHCO) $(ADDMADWEIGHT)

#------------------------------------------------------------------------------

.SUFFIXES: .$(SrcSuf) .$(ObjSuf)
.PHONY:	clean

all:            $(PROGRAMS)

$(HISTCOMBINED1):	$(HISTCOMBINED1O)
			$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt)$@
			$(MT_EXE)
			@echo "$@ done"

$(HISTCOMBINED2):	$(HISTCOMBINED2O)
			$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt)$@
			$(MT_EXE)
			@echo "$@ done"

$(TREELHE):	$(TREELHEO)
		$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt)$@
		$(MT_EXE)
		@echo "$@ done"

$(TREELHCO):	$(TREELHCOO)
		$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt)$@
		$(MT_EXE)
		@echo "$@ done"

$(ADDMADWEIGHT):	$(ADDMADWEIGHTO)
			$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt)$@
			$(MT_EXE)
			@echo "$@ done"

clean:
		@rm -f $(OBJS)

.$(SrcSuf).$(ObjSuf):
	$(CXX)  $(CXXFLAGS) -c $<

treeCreationLHE.$(ObjSuf):	treeCreationLHE.h
treeCreationLHEDict.$(SrcSuf):	treeCreationLHE.h
				@echo "Generating dictionary $@..."
				$(ROOTCLING) -f $@ -c $^
